package com.fsl.springbootdesignpattern.c_adapter;

public class AdapterTest {

    public static void main(String[] args) {

        AC ac1 = new AC110();
        AC ac2 = new AC220();

        //持续稳定的输出5V，或者不供电
        getOutPut(ac1);
        getOutPut(ac2);
    }

    public static int getOutPut(AC ac){
        if(ac.outPutAc()==110){
            return new JapaneseAdapter().outputDC5V(ac);
        }else if(ac.outPutAc()==220){
            return new ChineseAdapter().outputDC5V(ac);
        }else{
            System.out.println("没有合适的适配器，不供电");
            return 0;
        }
    }

}
